package com.hongshan.wallet.core.home

import android.app.Application
import android.databinding.ObservableField
import com.hongshan.wallet.base.MyViewModel
import com.hongshan.wallet.bean.TradingAlertBean
import com.hongshan.wallet.format

/**
 * Copyright Zhangxx.
 * Copyright (c) 2019
 * All rights reserved
 *
 * @project  : Wallet
 * @package  : com.example.wallet.core.trading
 * @author   : zhangxx
 * @date     : 2019/3/28
 * @email    : qq957413212@hotmail.com
 * @desc     : //TODO
 */
class TradingAlertViewModel(application: Application) : MyViewModel(application) {

    val money = ObservableField("10000.00")
    val tradingType = ObservableField("10000.00")
    val receiveAcc = ObservableField("10000.00")
    val payAcc = ObservableField("无")
    val tradingTime = ObservableField("10000.00")
    val remark = ObservableField("10000.00")

    fun setItemInfo(tradingAlertBean: TradingAlertBean) {
        money.set(tradingAlertBean.price?.toString())
        tradingType.set(when(tradingAlertBean.pay_type){
            1 -> "支付宝收款"
            2 -> "微信收款"
            else -> null
        })
        receiveAcc.set(tradingAlertBean.account)
        tradingTime.set(tradingAlertBean.pay_time.format("yyyy-MM-dd HH:mm"))
        remark.set(tradingAlertBean.remark)
//        orderId = tradingAlertBean.id
    }

}